package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.example.demo.model.bean.Ticket;
import com.example.demo.model.dao.UserDAO;

import java.util.List;

// @RestController = @Controller + @ResponseBody
@Controller
public class BasicController {
	
	@Autowired
	private UserDAO userDAO;
	
	@RequestMapping("/q")
	public String index(ModelMap map) {
		List<Ticket> users = userDAO.find();
		map.put("tickets",users);
		return "login"; // 此处表示返回值是一个值为“login”的String。不指向界面的原因是类的注解是@RestController
	}


}
